home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
cpp_libs
/
awe2-0_1.lha
/
awe2-0.1
/
Src
/
RCS
/
SpinBarrier.h,v
< prev
next >
Wrap
Text File
|
1989-02-22
|
4KB
|
256 lines
head 3.2;
branch ;
access ;
symbols ;
locks grunwald:3.2; strict;
comment @ * @;
3.2
date 89.02.20.15.37.32; author grunwald; state Exp;
branches ;
next 3.1;
3.1
date 88.12.20.13.50.18; author grunwald; state Exp;
branches ;
next 1.3;
1.3
date 88.10.30.13.06.05; author grunwald; state Exp;
branches ;
next 1.2;
1.2
date 88.09.28.22.13.43; author grunwald; state Exp;
branches ;
next 1.1;
1.1
date 88.09.18.16.42.07; author grunwald; state Exp;
branches ;
next ;
desc
@@
3.2
log
@Start using Gnu library heaps for schedulers
@
text
@// This may look like C code, but it is really -*- C++ -*-
//
// Copyright (C) 1988 University of Illinois, Urbana, Illinois
//
// written by Dirk Grunwald (grunwald@@cs.uiuc.edu)
//
#ifndef SpinBarrier_h
#define SpinBarrier_h
//
// Implement a UNIX process barrier
//
#include "SpinLock.h"
#include "Config.h"
#include "assert.h"
class SpinBarrier : SpinLock {
short pHeight;
short pCount;
short generation;
short pLoops;
int pMaxLoops;
public:
SpinBarrier( int h, int loops = DefaultSpinBarrierLoops, int max = 0 );
~SpinBarrier();
//
// Normal entry. Everyone calls rendezvous()
//
int rendezvous();
//
// lowerBarrier forces all waiting jobs to continue
//
void lowerBarrier();
//
// Changing the height of the barrier can cause people to continue
// if it is lowered below the current pCount.
//
int height();
void height(int h);
//
// loops() is the numbr of times a barrier spins before doing a getpid()
// to release the UNIX cpu. maxLoopss() the maximum number of getpids()
// to do before returning from the barrier (i.e. for barrier with timeout)
//
int loops();
void loops(int h);
int maxLoops();
void maxLoops(int h);
int count();
};
inline
SpinBarrier::SpinBarrier( int h, int l, int m )
{
pHeight = h;
pLoops = l;
pMaxLoops = m;
pCount = 0;
}
inline int
SpinBarrier::height()
{
return(pHeight);
}
inline int
SpinBarrier::loops()
{
return(pLoops);
}
inline void
SpinBarrier::loops(int h)
{
pLoops = h;
}
inline int
SpinBarrier::maxLoops()
{
return(pMaxLoops);
}
inline void
SpinBarrier::maxLoops(int h)
{
pMaxLoops = h;
}
inline int
SpinBarrier::count()
{
return(pCount);
}
inline
SpinBarrier::~SpinBarrier()
{
assert( pCount == 0 );
}
#endif
@
3.1
log
@Steay version
@
text
@@
1.3
log
@*** empty log message ***
@
text
@d18 1
a18 1
class SpinBarrier : public SpinLock {
d20 1
a20 1
short count;
d23 1
d25 1
a25 1
SpinBarrier( int h, int loops = DefaultSpinBarrierLoops );
d27 14
d43 12
a54 1
void rendezvous();
d58 1
a58 1
SpinBarrier::SpinBarrier( int h, int l )
d62 2
a63 1
count = 0;
d72 6
d79 1
a79 1
SpinBarrier::height(int h)
d81 1
a81 1
pHeight = h;
d84 18
d105 1
a105 1
assert( count == 0 );
@
1.2
log
@*** empty log message ***
@
text
@d1 8
a8 2
#ifndef HardBarrier_h
#define HardBarrier_h
d14 2
a15 1
#include "HardSpinLock.h"
d18 1
a18 1
class HardBarrier : public HardSpinLock {
d24 2
a25 2
HardBarrier( int h, int loops = 1000 );
~HardBarrier();
d32 1
a32 1
HardBarrier::HardBarrier( int h, int l )
d40 1
a40 1
HardBarrier::height()
d46 1
a46 1
HardBarrier::height(int h)
d52 1
a52 1
HardBarrier::~HardBarrier()
@
1.1
log
@Initial revision
@
text
@d9 1
d11 1
a11 2
class HardBarrier {
HardSpinLock lock;
d15 1
d17 1
a17 1
HardBarrier( int h );
d25 1
a25 1
HardBarrier::HardBarrier( int h )
d28 1
d47 1
@